/*
 * TaskOne.java
 *
 * Created on 05. Juni 2007, 03:47
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package sbc;

import sbc.fact.*;

import sbc.util.*;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.xvsm.api.core.*;
import org.xvsm.client.ClientCapi;
import org.apache.log4j.*;

/**
 *
 * @author mustermark
 */
public class TaskTwo {
    
    static Logger logger = Logger.getLogger(TaskOne.class);
    public final static String CONTAINER_NAME = "DefaultContainer";
    
    public static void main(String[] args) {
        
        Capi capi;
        if (args.length != 1) {
            System.out.println("URL needed!");
            System.out.println("Usage: java -cp <classpath> org.xvsm.example.Fifo http://localhost:8084/xvsm/xvsm\n using embeded core");
            capi = CapiFactory.createCapi();
        } else {
          capi = new ClientCapi(args[0]);
        }
        capi.init(true);
        try {
            ContainerRef cref = Util.getOrCreateNamedContainer(capi, sbc.TaskTwo.CONTAINER_NAME, CoordinationTypes.FIFO);
            UI ui = new UI(capi, cref);
            
        } catch(Exception ex) { 
            ex.printStackTrace(); 
            System.exit(-1);
        }
        
        CorsoBridge bridge = new CorsoBridge(capi);
        //Factory fact = new Factory(Factory.DEFAULT_FACTORY_NAME);
        //fact.open();
        //bridge.addClient(fact.getStorage().getOid());
        //bridge.establish();
        
        
    }
    
}
